<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>门诊登记</title>
<%@ include file="/common/meta.jsp"%>
<link href="${ctx}/js/validate/jquery.validate.css" type="text/css" rel="stylesheet"/>
<script src="${ctx}/js/validate/jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript" src="${ctx}/js/jquery-ui.min.js"></script>
<script src="${ctx}/js/validate/messages_cn.js" type="text/javascript"></script>
<script>
		$(document).ready(function() {
			//聚焦第一个输入框
			$("#apptNo").focus();

			$("#register").validate({
				rules: {
					apptNo: "required"
				}
			});
		});
		
		function getApptInfo(){
			
			$("#message").hide();
			if($("#apptNo").val()!=""){
				$("#apptInfo").html("");
				$.getJSON("clinic-register!getApptInfo.action",{apptNo:$("#apptNo").val()},function(json){
					if(json == null){
						$("#apptInfo").append(
								"<tr><td colspan="+3+">预约信息如下：</td> </tr>"
								+"<tr>"
								+"<td>"+"没有对应信息。"+"</td>"
								+"</tr>"
								);
					} else{
						$.each(json,function(i){
							$("#apptInfo").append(
									"<tr><td colspan="+3+">预约信息如下：</td> </tr>"
									+"<tr>"
									+"<td>"+"职工号/学号："+"</td>"
									+"<td>"+json[i].comments+"</td>"
						            +"<td>"+"预约时间："+"</td>"
									+"<td>"+json[i].creatDate+"</td>"
									+"</tr>"
									+"<tr>"
									+"<td>"+"预约号码："+"</td>"
									+"<td>"+json[i].apptNo+"</td>"
						            +"<td>"+"就诊时间："+"</td>"
									+"<td>"+json[i].scheduledDate+"</td>"
									+"</tr>"
									+"<tr>"
									+"<td>"+"描述症状："+"</td>"
									+"<td colspan="+3+">"+json[i].symptom+"</td>"
									+"</tr>"
									);
						});
					}
			});
		}
	}	
	</script>
</head>
<body>
<table class="noborder">
	<tr>
		<td align="left">
		<div style="font-family: Arial; font-size: 15px; font-weight: bold; font-style: normal">当前位置：校园诊所--门诊预约登记</div>
		</td>
	</tr>
</table>

<form id="register" action="clinic-register!apptsave.action" method="post">
<div id="message"><s:actionmessage theme="mytheme" cssClass="success" /></div>
<table width="60%" class="noborder">

	<tr>
		<td>预约号：</td>
		<td><input type="text" id="apptNo" name="apptNo" size="20" onchange="getApptInfo();"/></td>
	</tr>
	<tr><td colspan="2"><table id="apptInfo" class="noborder"></table></td></tr>
	<tr>
		<td><s:submit type="button" theme="simple">登记完成</s:submit></td>
		<td></td>
	</tr>
</table>
</form>
</body>
</html>